<script>
  import app from '@/g.js'
	export default {
		onLaunch: function() {
			console.log('App Launch')
      let isInWx = app.global.isInWx();
      if(!isInWx){ 
        return 
      }
      app.api.loadJs('https://res.wx.qq.com/open/js/jweixin-1.6.0.js').then(res => {
        return app.api.wxConfig()
      }).then(res => {
        wx.ready(function() {
          app.wxReady$.resolve(wx)
        });
        res.debug = false;
        res.jsApiList = ['onMenuShareTimeline','onMenuShareAppMessage','getLocation'];
        wx.config(res)
      });
      if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
        handleFontSize()
      } else {
        if (document.addEventListener) {
          document.addEventListener("WeixinJSBridgeReady", handleFontSize, false)
        } else if (document.attachEvent) {
          document.attachEvent("WeixinJSBridgeReady", handleFontSize);
          document.attachEvent("onWeixinJSBridgeReady", handleFontSize)
        }
      }
      function handleFontSize() {
        WeixinJSBridge.invoke('setFontSizeCallback', {
          'fontSize': 0
        });
        WeixinJSBridge.on('menu:setfont', function() {
          WeixinJSBridge.invoke('setFontSizeCallback', {
            'fontSize': 0
          })
        })
      }  
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>
<style lang="scss">
	/*每个页面公共css */
  @import './style/animate.min.css';
  @import './style/main.scss';
</style>
